home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: smeyers@netcom.com (Scott Meyers)
- Newsgroups: comp.std.c++
- Subject: extern inlines
- Date: 10 Mar 1996 16:39:20 PST
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <smeyersDo1L8o.99t@netcom.com>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Sun, 10 Mar 1996 08:07:36 GMT
- Apparently-To: comp-std-c++@uunet.uu.net
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMUN2Q0y4NqrwXLNJAQECPgIAylje5jPdZdWNBRjQyTJvBkYlr2dZYbBR
- CtGS0+n1RZOTGFomuyIly6ss70HMbJAZAqIceyyxOgSMo3UkxfzUww==
- =17uF
- Originator: austern@isolde.mti.sgi.com
-
- I'm a little confused about the meaning of extern inline functions.
- DWP 7.1.1.4 makes it clear that extern inline functions have external
- linkage, so I have two questions.
-
- 1. Suppose this definition occurs in header1.h:
-
- extern inline f() { cout << "Hello."; }
-
- Further suppose that header1.h is #included by file1.cpp, file2.cpp, and
- file3.cpp and that, for whatever reason, f is NOT inlined. Which object
- file will contain the definition of f? My understanding is that only
- one of them will.
-
- 2. Now suppose there is a second header file header2.h, which contains
- this definition:
-
- extern inline f() { cout << "Goodbye."; } // note that this is
- // not the same as f above
-
- If I link together an object file containing the definition of f
- from header1.h and another object file containing the definition of
- f from header2.h, am I correct in assuming that the resulting
- program violates the one definition rule and that this violation
- need not be diagnosed?
-
- Thanks,
-
- Scott
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-